<template>
  <div>
    <el-breadcrumb separator-class="el-icon-arrow-right" class="nav">
      <el-breadcrumb-item to="/welcome"
        ><strong>首页</strong></el-breadcrumb-item
      >
      <el-breadcrumb-item>数据统计</el-breadcrumb-item>
      <el-breadcrumb-item>数据报表 </el-breadcrumb-item>
    </el-breadcrumb>
    <el-card class="box-card">
      <div id="main" style="width: 750px; height: 400px"></div>
    </el-card>
  </div>
</template>
<script>
import * as echarts from 'echarts'
import { dataApi } from '@/api/data'
export default {
  name: '',
  data () {
    return {
      options: {
        title: {
          text: '用户来源'
        },
        tooltip: {
          trigger: 'axis',
          axisPointer: {
            type: 'cross',
            label: {
              backgroundColor: '#E9EEF3'
            }
          }
        },
        grid: {
          left: '3%',
          right: '4%',
          bottom: '3%',
          containLabel: true
        },
        xAxis: [
          {
            boundaryGap: false
          }
        ],
        yAxis: [
          {
            type: 'value'
          }
        ]
      }

    }
  },
  created () {

  },
  computed: {
  },
  methods: {
    async getdataList () {
    }
  },
  async mounted () {
    const myChart = echarts.init(document.getElementById('main'))
    const res = await dataApi()
    const result = _.merge(res.data, this.options)
    myChart.setOption(result)

    // 绘制图表
    // myChart.setOption({
    //   title: {
    //     text: '用户来源'
    //   },
    //   tooltip: {
    //     trigger: 'axis',
    //     axisPointer: {
    //       type: 'cross',
    //       label: {
    //         backgroundColor: '#E9EEF3'
    //       }
    //     }
    //   },

    //   xAxis: {
    //     data: [...this.xAxis]
    //   },
    //   yAxis: {},
    //   series: [
    //     {
    //       name: '用户来源',
    //       type: 'bar',
    //       data: [5, 20, 36, 10, 10, 20]
    //     }
    //   ]
    // })
  }
}
</script>
<style lang='less'  scoped>
.nav {
  font-size: 12px;
  margin-bottom: 15px;
}
</style>
